﻿using System;
using System.Html.DOM;

namespace jQueryLib
{
    partial class JQueryInstance
    {
        /// <summary>
        /// Add elements to the set of matched elements.
        /// </summary>
        /// <param name="htmlElement"></param>
        /// <returns></returns>
        public abstract JQueryInstance Add(string htmlElement);

        /// <summary>
        /// Add elements to the set of matched elements.
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        public abstract JQueryInstance Add(HtmlElement element);

        /// <summary>
        /// Add elements to the set of matched elements.
        /// </summary>
        /// <param name="instance"></param>
        /// <returns></returns>
        public abstract JQueryInstance Add(JQueryInstance instance);

        /// <summary>
        /// Add elements to the set of matched elements.
        /// </summary>
        /// <param name="selector"></param>
        /// <param name="ctx"></param>
        /// <returns></returns>
        public abstract JQueryInstance Add(string selector, JQueryInstance context);

        /// <summary>
        /// Add elements to the set of matched elements.
        /// </summary>
        /// <param name="selector"></param>
        /// <param name="element"></param>
        /// <returns></returns>
        public abstract JQueryInstance Add(string selector, HtmlElement context);

        /// <summary>
        /// Remove elements from the set of matched elements.
        /// </summary>
        /// <param name="selector"></param>
        /// <returns></returns>
        public abstract JQueryInstance Not(string selector);

        /// <summary>
        /// Remove elements from the set of matched elements.
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        public abstract JQueryInstance Not(HtmlElement element);

        /// <summary>
        /// Remove elements from the set of matched elements.
        /// </summary>
        /// <param name="instance"></param>
        /// <returns></returns>
        public abstract JQueryInstance Not(JQueryInstance instance);

        /// <summary>
        /// Remove elements from the set of matched elements.
        /// </summary>
        /// <param name="func">A function used as a test for each element in the set. this is the current DOM element.</param>
        /// <returns></returns>
        public abstract JQueryInstance Not(Func<bool, int> func);

        /// <summary>
        /// Get the children of each element in the set of matched elements, including text and comment nodes.
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Contents();

        /// <summary>
        /// Add the previous set of elements on the stack to the current set.
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance AndSelf();

        /// <summary>
        /// End the most recent filtering operation in the current chain and return the set of matched elements to its previous state.
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance End();

        /// <summary>
        /// Reduce the set of matched elements to the one at the specified index.
        /// </summary>
        /// <param name="index">if negative, counting backwards from the last element in the set.</param>
        /// <returns></returns>
        public abstract JQueryInstance Eq(int index);

        /// <summary>
        /// Reduce the set of matched elements to those that match the selector.
        /// </summary>
        /// <param name="selector"></param>
        /// <returns></returns>
        public abstract JQueryInstance Filter(string selector);

        /// <summary>
        /// Reduce the set of matched elements to those that matches the element.
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        public abstract JQueryInstance Filter(HtmlElement element);

        /// <summary>
        /// Reduce the set of matched elements to those that matches the jquery.
        /// </summary>
        /// <param name="instance"></param>
        /// <returns></returns>
        public abstract JQueryInstance Filter(JQueryInstance instance);

        /// <summary>
        /// Reduce the set of matched elements to those that pass the function's test.
        /// </summary>
        /// <param name="func">A function used as a test for each element in the set. this is the current DOM element.</param>
        /// <returns></returns>
        public abstract JQueryInstance Filter(Func<bool, int> func);

        /// <summary>
        /// Reduce the set of matched elements to the first in the set.
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance First();

        /// <summary>
        /// Reduce the set of matched elements to the final one in the set.
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Last();

        /// <summary>
        /// Reduce the set of matched elements to those that have a descendant that matches the selector.
        /// </summary>
        /// <param name="selector"></param>
        /// <returns></returns>
        public abstract JQueryInstance Has(string selector);

        /// <summary>
        /// Reduce the set of matched elements to those that have a descendant that matches the DOM element.
        /// </summary>
        /// <param name="contained"></param>
        /// <returns></returns>
        public abstract JQueryInstance Has(HtmlElement contained);

        /// <summary>
        /// Reduce the set of matched elements to a subset specified by a range of indices.
        /// </summary>
        /// <param name="start"></param>
        /// <returns></returns>
        public abstract JQueryInstance Slice(int start);

        /// <summary>
        /// Reduce the set of matched elements to a subset specified by a range of indices.
        /// </summary>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <returns></returns>
        public abstract JQueryInstance Slice(int start, int end);

        /// <summary>
        /// Pass each element in the current matched set through a function, producing a new jQuery object containing the return values.
        /// </summary>
        /// <param name="func">object function(index, DOMElement)
        /// <para>this refers to the current DOM element for each iteration</para>
        /// </param>
        /// <returns></returns>
        public abstract JQueryInstance Map(Func<object, int, HtmlElement> func);

        /// <summary>
        /// Check the current matched set of elements against a selector and return true if at least one of these elements matches the given arguments.
        /// </summary>
        /// <param name="selector"></param>
        /// <returns></returns>
        public abstract bool Is(string selector);

        /// <summary>
        /// Check the current matched set of elements against an element and return true if at least one of these elements matches the given arguments.
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        public abstract bool Is(HtmlElement element);

        /// <summary>
        /// Check the current matched set of elements against a jQuery object and return true if at least one of these elements matches the given arguments.
        /// </summary>
        /// <param name="instance"></param>
        /// <returns></returns>
        public abstract bool Is(JQueryInstance instance);

        /// <summary>
        /// Check the current matched set of elements against a function and return true if at least one of these elements matches the given arguments.
        /// </summary>
        /// <param name="func">bool function(index)
        /// <para>A function used as a test for the set of elements. It accepts one argument, index, which is the element's index in the jQuery collection.Within the function, this refers to the current DOM element.</para>
        /// </param>
        /// <returns></returns>
        public abstract bool Is(Func<bool, int> func);

        /// <summary>
        /// Get the children of each element in the set of matched elements.
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Children();

        /// <summary>
        /// Get the children of each element in the set of matched elements, filtered by a selector.
        /// </summary>
        /// <param name="selector"></param>
        /// <returns></returns>
        public abstract JQueryInstance Children(string selector);

        /// <summary>
        /// Get the siblings of each element in the set of matched elements.
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Siblings();

        /// <summary>
        /// Get the siblings of each element in the set of matched elements filtered by a selector.
        /// </summary>
        /// <param name="selector"></param>
        /// <returns></returns>
        public abstract JQueryInstance Siblings(string selector);

        /// <summary>
        /// Get the descendants of each element in the current set of matched elements, filtered by selector.
        /// </summary>
        /// <param name="selector"></param>
        /// <returns></returns>
        public abstract JQueryInstance Find(string selector);

        /// <summary>
        /// Get the descendants of each element in the current set of matched elements, filtered by element.
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        public abstract JQueryInstance Find(HtmlElement element);

        /// <summary>
        /// Get the descendants of each element in the current set of matched elements, filtered by jQuery object.
        /// </summary>
        /// <param name="instance"></param>
        /// <returns></returns>
        public abstract JQueryInstance Find(JQueryInstance instance);

        /// <summary>
        /// Get the first element that matches the selector, beginning at the current element and progressing up through the DOM tree.
        /// </summary>
        /// <param name="selector"></param>
        /// <returns></returns>
        public abstract JQueryInstance Closest(string selector);

        /// <summary>
        /// Get the first element that matches the selector, beginning at the current element and progressing up through the DOM tree.
        /// </summary>
        /// <param name="selector"></param>
        /// <param name="context"></param>
        /// <returns></returns>
        public abstract JQueryInstance Closest(string selector, JQueryInstance context);

        /// <summary>
        /// Get the first element that matches the selector, beginning at the current element and progressing up through the DOM tree.
        /// </summary>
        /// <param name="selector"></param>
        /// <param name="context"></param>
        /// <returns></returns>
        public abstract JQueryInstance Closest(string selector, HtmlElement context);

        /// <summary>
        /// Get the first element that matches the selector, beginning at the current element and progressing up through the DOM tree.
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        public abstract JQueryInstance Closest(HtmlElement element);

        /// <summary>
        /// Get the first element that matches the selector, beginning at the current element and progressing up through the DOM tree.
        /// </summary>
        /// <param name="instance"></param>
        /// <returns></returns>
        public abstract JQueryInstance Closest(JQueryInstance instance);

        /// <summary>
        /// Get the immediately following sibling of each element in the set of matched elements.
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Next();

        /// <summary>
        /// Get the immediately following sibling of each element in the set of matched elements..
        /// </summary>
        /// <param name="selector"></param>
        /// <returns></returns>
        public abstract JQueryInstance Next(string selector);

        /// <summary>
        /// Get all following siblings of each element in the set of matched elements
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance NextAll();

        /// <summary>
        /// Get all following siblings of each element in the set of matched elements
        /// </summary>
        /// <param name="selector"></param>
        /// <returns></returns>
        public abstract JQueryInstance NextAll(string selector);

        /// <summary>
        /// Get all following siblings of each element up to but not including the element matched by the selector.
        /// </summary>
        /// <param name="selector"></param>
        /// <returns></returns>
        public abstract JQueryInstance NextUntil(string selector);

        /// <summary>
        /// Get all following siblings of each element up to but not including the element matched by the selector.
        /// </summary>
        /// <param name="selector"></param>
        /// <param name="filter">A string containing a selector expression to match elements against.</param>
        /// <returns></returns>
        public abstract JQueryInstance NextUntil(string selector, string filter);

        /// <summary>
        /// Get all following siblings of each element up to but not including the element matched by the DOM node passed.
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        public abstract JQueryInstance NextUntil(HtmlElement element);

        /// <summary>
        /// Get all following siblings of each element up to but not including the element matched by the DOM node passed.
        /// </summary>
        /// <param name="element"></param>
        /// <param name="filter">A string containing a selector expression to match elements against.</param>
        /// <returns></returns>
        public abstract JQueryInstance NextUntil(HtmlElement element, string filter);

        /// <summary>
        /// Get all following siblings of each element up to but not including the element matched by the jQuery object passed.
        /// </summary>
        /// <param name="instance"></param>
        /// <returns></returns>
        public abstract JQueryInstance NextUntil(JQueryInstance instance);

        /// <summary>
        /// Get all following siblings of each element up to but not including the element matched by the jQuery object passed.
        /// </summary>
        /// <param name="instance"></param>
        /// <param name="filter">A string containing a selector expression to match elements against.</param>
        /// <returns></returns>
        public abstract JQueryInstance NextUntil(JQueryInstance instance, string filter);

        /// <summary>
        /// Get the immediately preceding sibling of each element in the set of matched elements.
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Prev();

        /// <summary>
        /// Get the immediately preceding sibling of each element in the set of matched elements filtered by a selector.
        /// </summary>
        /// <param name="selector"></param>
        /// <returns></returns>
        public abstract JQueryInstance Prev(string selector);

        /// <summary>
        /// Get all preceding siblings of each element in the set of matched elements
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance PrevAll();

        /// <summary>
        /// Get all preceding siblings of each element in the set of matched elements filtered by a selector.
        /// </summary>
        /// <param name="selector"></param>
        /// <returns></returns>
        public abstract JQueryInstance PrevAll(string selector);

        /// <summary>
        /// Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object.
        /// </summary>
        /// <param name="selector"></param>
        /// <returns></returns>
        public abstract JQueryInstance PrevUntil(string selector);

        /// <summary>
        /// Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object.
        /// </summary>
        /// <param name="selector"></param>
        /// <param name="filter">A string containing a selector expression to match elements against.</param>
        /// <returns></returns>
        public abstract JQueryInstance PrevUntil(string selector, string filter);

        /// <summary>
        /// Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object.
        /// </summary>
        /// <param name="instance"></param>
        /// <returns></returns>
        public abstract JQueryInstance PrevUntil(JQueryInstance instance);

        /// <summary>
        /// Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object.
        /// </summary>
        /// <param name="instance"></param>
        /// <param name="filter">A string containing a selector expression to match elements against.</param>
        /// <returns></returns>
        public abstract JQueryInstance PrevUntil(JQueryInstance instance, string filter);

        /// <summary>
        /// Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object.
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        public abstract JQueryInstance PrevUntil(HtmlElement element);

        /// <summary>
        /// Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object.
        /// </summary>
        /// <param name="element"></param>
        /// <param name="filter">A string containing a selector expression to match elements against.</param>
        /// <returns></returns>
        public abstract JQueryInstance PrevUntil(HtmlElement element, string filter);

        /// <summary>
        /// Get the closest ancestor element that is positioned.
        /// An element is said to be positioned if it has a CSS position attribute of relative, absolute, or fixed. 
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance OffsetParent();

        /// <summary>
        /// Get the parent of each element in the current set of matched elements.
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Parent();

        /// <summary>
        /// Get the parent of each element in the current set of matched elements filtered by a selector.
        /// </summary>
        /// <param name="selector"></param>
        /// <returns></returns>
        public abstract JQueryInstance Parent(string selector);

        /// <summary>
        /// Get the ancestors of each element in the current set of matched elements.
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Parents();

        /// <summary>
        /// Get the ancestors of each element in the current set of matched elements filtered by a selector.
        /// </summary>
        /// <param name="selector"></param>
        /// <returns></returns>
        public abstract JQueryInstance Parents(string selector);

        /// <summary>
        /// Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector.
        /// </summary>
        /// <param name="selector"></param>
        /// <returns></returns>
        public abstract JQueryInstance ParentsUntil(string selector);

        /// <summary>
        /// Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector.
        /// </summary>
        /// <param name="selector"></param>
        /// <param name="filter">A string containing a selector expression to match elements against.</param>
        /// <returns></returns>
        public abstract JQueryInstance ParentsUntil(string selector, string filter);

        /// <summary>
        /// Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the DOM node.
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        public abstract JQueryInstance ParentsUntil(HtmlElement element);

        /// <summary>
        /// Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the DOM node.
        /// </summary>
        /// <param name="element"></param>
        /// <param name="filter">A string containing a selector expression to match elements against.</param>
        /// <returns></returns>
        public abstract JQueryInstance ParentsUntil(HtmlElement element, string filter);

        /// <summary>
        /// Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the jQuery object.
        /// </summary>
        /// <param name="instance"></param>
        /// <returns></returns>
        public abstract JQueryInstance ParentsUntil(JQueryInstance instance);

        /// <summary>
        /// Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the jQuery object.
        /// </summary>
        /// <param name="instance"></param>
        /// <param name="filter">A string containing a selector expression to match elements against.</param>
        /// <returns></returns>
        public abstract JQueryInstance ParentsUntil(JQueryInstance instance, string filter);
    }
}
